package com.huangsm.book.designmodel.parallel.future;

/**
 * 客户端的实现
 * 主要实现了获取FutureData，开启构造RealData的线程，并在接收请求后，很快地返回FutureData
 *
 * @author huang
 * @date 2019/2/18
 */
public class Client {
    public Data request(final String queryStr) {
        final FutureData future = new FutureData();
        Runnable task=()->{
            RealData realData=new RealData(queryStr);
            future.setRealData(realData);
        };
        task.run();
        return future;
    }
}
